<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>LOGIN</title>
</head>
<body>
  <h2>LOGIN</h2>
  <form th:action="@{/login}" method="get">
    <p>name: <input name="name" id="name"/></p>
    <p>pwd : <input name="pwd" id="pwd"/></p>
    <input type="submit"/>
  </form>
  <button id="btn">ajax-Login</button>
  <script>
      onload = function () {
        var btn = document.querySelector('#btn');
        btn.addEventListener('click', () => {
          var name = document.querySelector('#name');
          var pwd = document.querySelector('#pwd')
          console.log(name.value, pwd.value)
          fetch(`http://localhost:18080/thymeleaf/loginV2/${name.value}/${pwd.value}`);
        })
      }
  </script>

</body>
</html>